import dayjs, { Dayjs } from 'dayjs';
import 'dayjs/locale/zh-cn';
import updateLocale from 'dayjs/plugin/updateLocale';
import duration from 'dayjs/plugin/duration';
import calenderPlugin from 'dayjs/plugin/calendar';

dayjs.extend(calenderPlugin);
dayjs.extend(duration);
dayjs.extend(updateLocale);

dayjs.updateLocale('zh-cn', {
  weekdaysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  weekdays: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  calendar: {
    lastDay: 'YYYY.MM.DD [昨天] A h:mm dddd',
    sameDay: 'YYYY.MM.DD [今天] A h:mm dddd',
    nextDay: 'YYYY.MM.DD [明天] A h:mm dddd',
    lastWeek: 'YYYY.MM.DD A h:mm [上]dddd',
    nextWeek: 'YYYY.MM.DD A h:mm [下]dddd',
    sameElse: 'YYYY.MM.DD A h:mm dddd'
  }
});

export { dayjs, Dayjs };
